import 'package:bruno/bruno.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:sph_shipper/AppConfig/Config.dart';
import 'package:sph_shipper/SendGoods/PerfectGoods.dart';
import 'package:sph_shipper/SendGoods/TMSOrlder/AddCarrierDrivers.dart';

import '../../AppConfig/RouteAct.dart';
import '../AddGoodsFirst.dart';
import '../LoadingAddressView.dart';
import 'AddCarrierVehicles.dart';
import 'TMSChooseDriver.dart';

class ConfirmScheduling extends StatefulWidget {
  const ConfirmScheduling({super.key});

  @override
  State<ConfirmScheduling> createState() => _ConfirmSchedulingState();
}

class _ConfirmSchedulingState extends State<ConfirmScheduling> {
  bool isAddStart = false;
  bool isAddEnd = false;
  String goodsMessage = "";
  String parentDictValue = "";
  List carLength=[];
  List carType=[];
  String startCitynameOne ="";
  List startCitycodeOne =[];
  String startCitynameTwo ="";
  List startCitycodeTwo =[];
  String endCitynameOne ="";
  List endCitycodeOne =[];
  String endCitynameTwo ="";
  List endCitycodeTwo =[];
  String selectedProvince = '';
  String selectedCity = '';
  String selectedDistrict = '';
  String selectedCityCode = '';
  List startAddressOne=[];
  List startAddressTwo=[];
  List endAddressOne=[];
  List endAddressTwo=[];
  List cityData = [];
  String storedData = '';
  int selectedTileIndexone=-1;
  int selectedTileIndextwo=-1;
  int selectedTileIndexthree=-1;
  String detailAddressOne="";
  String detailAddressTwo="";
  String detailAddressThree="";
  String detailAddressFour="";
  Map startLocationOne={};
  Map startLocationTwo={};
  Map endLocationOne={};
  Map endLocationTwo={};
  String dintanceStr="";
  int titleType=1;
  String companyName="";
  String goodsWeight="";
  String goodsVolume="";
  int BidType=-1;
  String depositNum="";
  String priceNum="";
  int depositType=0;
  bool isChooseInsure=false;
  String remarkStr="";
  String isAgree="0";
  String schedulingMethod="";
  int invoiceType=0;
  int schedulingIndex=-1;
  String startTimeDay="";
  String startTimeHour="";
  String startTimeCode="";
  String endTimeDay="";
  String endTimeHour="";
  String endTimeCode="";
  int priceType=0;
  int showType=4;
  List scheduNameList=["王二二(18888888888)","王二二(18888888888)","王二二(18888888888)","王二二(18888888888)","王二二(18888888888)","王二二(18888888888)"];
  late TextEditingController _depositNumText = TextEditingController(text: depositNum);
  late TextEditingController _priceNumText = TextEditingController(text: priceNum);
  FocusNode _focusNode = FocusNode();
  @override
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      appBar: AppBar(
        title: Text("调度",style: TextStyle(fontWeight: FontWeight.w300,fontSize: 16.sp),),
        centerTitle: true,
        backgroundColor: Colors.white,
        leading: IconButton(icon: Icon(Icons.arrow_back_ios,color: Colors.black,),onPressed: (){Navigator.pop(context);},),
      ),
      body: Column(
        children: [
          Expanded(child: ListView(
            children: [
                  Container(
                    margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
                    padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
                    decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.all(Radius.circular(10))),
                    child:Column(
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                Text("组织",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                              ],

                            ),
                            Text("浙江速搜物流股份有限公司",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),
                          ],
                        ),

                      
                      ],
                    )

                  ),
              Container(
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(10))),
                margin: EdgeInsets.only(top: 8.h,left: 10.w,right: 10.w),
                padding: EdgeInsets.only(left: 10.w,right:10.w ,top: 10.h,bottom: 10.h),
                child: Column(
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [

                        Row(
                          children: [
                            Image.asset("lib/Images/OrderList/装货点icon.png",width: 20.w,height: 20.h,),
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Container(
                                  width:screenSize.width-120.w,
                                  padding: EdgeInsets.only(left: 10.w),
                                  child:   GestureDetector(
                                    child:Text(startCitynameOne!=""?startCitynameOne: "必填，请选择装货省市区",style: TextStyle(color:startCitynameOne!=""?Colors.black: MyColors.textColor,fontSize: 14.sp),),
                                    onTap: ()async{
                                      final result = await  showModalBottomSheet(context: context,
                                          isScrollControlled:true,
                                          isDismissible: false, // 设置为 false，点击外部区域不关闭
                                          enableDrag: false, // 设置为 false，禁用上滑手势关闭
                                          builder: (BuildContext context)
                                          {

                                            return chooseCitySheet(chooseType: 1,cityData: cityData, chooseCityList: startAddressOne,chooseCodeList: startCitycodeOne,);
                                          });
                                      if (result != null) {
                                        setState(() {
                                          startCitynameOne = result[0]+" "+result[1]+" "+result[2];
                                          startCitycodeOne =[result[3],result[4],result[5]];
                                          startAddressOne=[result[0],result[1],result[2]];
                                        });
                                      }
                                    },
                                  ),

                                ),

                                Divider(height: 10.h,color: Colors.black,),
                                Container(
                                  width:screenSize.width-120.w,
                                  padding: EdgeInsets.only(left: 10.w),
                                  child:   GestureDetector(
                                    child:Text(detailAddressOne!=""?detailAddressOne:"必填，请填写详细地址",overflow: TextOverflow.clip,style: TextStyle(color: detailAddressOne!=""?Colors.black:MyColors.hintColor,fontSize: 14.sp),),
                                    onTap: ()async{
                                      final result = await  Navigator.push( context, FadeRoute(page:LoadingAddressView(addressType: 1, query:startAddressOne.isNotEmpty?startAddressOne[1]:"",)));
                                      if(result!=null){
                                        setState(() {
                                          startCitynameOne=result['province']+" "+result['city']+" "+result['district'];
                                          startCitycodeOne=[result['adcode'].substring(0, 2)+"0000",result['adcode'].substring(0, 4)+"00",result['adcode']];
                                          startAddressOne=[result['province'],result['city'],result['district']];
                                          detailAddressOne=result['address'];
                                          startLocationOne=result['location'];
                                          if(detailAddressOne!=""&&detailAddressThree!=""){
                                            // getDistanceAction();
                                          }
                                        });

                                      }
                                    },
                                  ),

                                ),


                              ],
                            )
                          ],
                        ),
                        isAddStart ==false?
                        IconButton(onPressed: (){
                          setState(() {
                            isAddStart=true;
                          });
                        }, icon: Icon(Icons.add_circle_outline,color: MyColors.textColor,))
                            :SizedBox(width: 10.w,),
                      ],
                    ),
                    Divider(height: 20.h,color: MyColors.backgreyColor,),
                    if (isAddStart==true)
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Image.asset("lib/Images/OrderList/装icon.png",width: 20.w,height: 10.h,),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: [
                                  Container(
                                    width:screenSize.width-120.w,
                                    padding: EdgeInsets.only(left: 10.w),
                                    child:   GestureDetector(
                                      child:Text(startCitynameTwo!=""?startCitynameTwo: "必填，请选择装货省市区",style: TextStyle(color:startCitynameTwo!=""?Colors.black: MyColors.textColor,fontSize: 14.sp),),
                                      onTap: ()async{
                                        final result = await  showModalBottomSheet(context: context,
                                            isScrollControlled:true,
                                            isDismissible: false, // 设置为 false，点击外部区域不关闭
                                            enableDrag: false, // 设置为 false，禁用上滑手势关闭
                                            builder: (BuildContext context)
                                            {
                                              return chooseCitySheet(chooseType: 2,cityData: cityData,chooseCityList: startAddressTwo,chooseCodeList: startCitycodeTwo,);
                                            });
                                        if (result != null) {
                                          setState(() {
                                            startCitynameTwo= result[0]+" "+result[1]+" "+result[2];
                                            startCitycodeTwo =[result[3],result[4],result[5]];
                                            startAddressTwo=[result[0],result[1],result[2]];
                                          });
                                        }
                                      },
                                    ),
                                  ),
                                  Divider(height: 10.h,color: MyColors.backgreyColor,),
                                  Container(
                                    width:screenSize.width-120.w,
                                    padding: EdgeInsets.only(left: 10.w),
                                    child:   GestureDetector(
                                      child:Text(detailAddressTwo!=""?detailAddressTwo:"必填，请填写详细地址",overflow: TextOverflow.clip,style: TextStyle(color: detailAddressTwo!=""?Colors.black:MyColors.hintColor,fontSize: 14.sp),),
                                      onTap: ()async{
                                        final result = await  Navigator.push( context, FadeRoute(page:LoadingAddressView(addressType: 2, query: startAddressTwo.isNotEmpty?startAddressTwo[1]:"",)));
                                        if(result!=null){
                                          setState(() {
                                            startCitynameTwo=result['province']+" "+result['city']+" "+result['district'];
                                            startCitycodeTwo=[result['adcode'].substring(0, 2)+"0000",result['adcode'].substring(0, 4)+"00",result['adcode']];
                                            startAddressTwo=[result['province'],result['city'],result['district']];
                                            detailAddressTwo=result['address'];
                                            startLocationTwo=result['location'];
                                          });

                                        }
                                      },
                                    ),

                                  ),

                                ],
                              )

                            ],
                          ),

                          IconButton(onPressed: (){
                            setState(() {
                              isAddStart=false;
                            });
                          }, icon: Icon(Icons.remove_circle_outline,color: MyColors.textColor,)),
                        ],
                      ),
                    if (isAddStart==true)
                      Divider(height: 20.h,color: MyColors.backgreyColor,),
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Row(
                          children: [
                            Image.asset("lib/Images/OrderList/卸货点icon.png",width: 20.w,height: 20.h,),

                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                Container(
                                  width:screenSize.width-120.w,
                                  padding: EdgeInsets.only(left: 10.w),
                                  child:   GestureDetector(
                                    child:Text(endCitynameOne!=""?endCitynameOne: "必填，请选择卸货省市区",style: TextStyle(color:endCitynameOne!=""?Colors.black: MyColors.textColor,fontSize: 14.sp),),
                                    onTap: ()async{
                                      final result = await  showModalBottomSheet(context: context,
                                          isScrollControlled:true,
                                          isDismissible: false, // 设置为 false，点击外部区域不关闭
                                          enableDrag: false, // 设置为 false，禁用上滑手势关闭
                                          builder: (BuildContext context)
                                          {
                                            return chooseCitySheet(chooseType: 3,cityData: cityData,chooseCityList: endAddressOne,chooseCodeList: endCitycodeOne,);
                                          });
                                      if (result != null) {
                                        setState(() {
                                          endCitynameOne = result[0]+" "+result[1]+" "+result[2];
                                          endCitycodeOne =[result[3],result[4],result[5]];
                                          endAddressOne=[result[0],result[1],result[2]];
                                        });
                                      }
                                    },
                                  ),

                                ),

                                Divider(height: 10.h,color: MyColors.backgreyColor,),

                                Container(
                                  width:screenSize.width-120.w,
                                  padding: EdgeInsets.only(left: 10.w),
                                  child:   GestureDetector(
                                    child:Text(detailAddressThree!=""?detailAddressThree:"必填，请填写详细地址",overflow: TextOverflow.clip,style: TextStyle(color: detailAddressThree!=""?Colors.black:MyColors.hintColor,fontSize: 14.sp),),
                                    onTap: ()async{
                                      final result = await  Navigator.push( context, FadeRoute(page:LoadingAddressView(addressType: 2, query:endAddressOne.isNotEmpty?endAddressOne[1]:"",)));
                                      if(result!=null){
                                        setState(() {
                                          endCitynameOne=result['province']+" "+result['city']+" "+result['district'];
                                          endCitycodeOne=[result['adcode'].substring(0, 2)+"0000",result['adcode'].substring(0, 4)+"00",result['adcode']];
                                          endAddressOne=[result['province'],result['city'],result['district']];
                                          detailAddressThree=result['address'];
                                          endLocationOne=result['location'];
                                          if(detailAddressOne!=""&&detailAddressThree!=""){

                                          }
                                        });

                                      }
                                    },
                                  ),

                                ),

                                // ),
                              ],
                            ),
                          ],
                        ),
                        isAddEnd==false?
                        IconButton(onPressed: (){
                          setState(() {
                            isAddEnd=true;
                          });
                        }, icon: Icon(Icons.add_circle_outline,color: MyColors.textColor,))
                            :SizedBox(width: 10.w,),
                      ],
                    ),
                    if (isAddEnd==true)
                      Divider(height: 20.h,color: MyColors.backgreyColor,),
                    if (isAddEnd==true)
                      Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Image.asset("lib/Images/OrderList/卸icon.png",width:20.w,height: 10.h,),
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                mainAxisAlignment: MainAxisAlignment.start,
                                children: [
                                  Container(
                                    width:screenSize.width-120.w,
                                    padding: EdgeInsets.only(left: 10.w),
                                    child:   GestureDetector(
                                      child:Text(endCitynameTwo!=""?endCitynameTwo: "必填，请选择卸货省市区",style: TextStyle(color:endCitynameTwo!=""?Colors.black: MyColors.textColor,fontSize: 14.sp),),
                                      onTap: ()async{
                                        final result = await  showModalBottomSheet(context: context,
                                            isScrollControlled:true,
                                            isDismissible: false, // 设置为 false，点击外部区域不关闭
                                            enableDrag: false, // 设置为 false，禁用上滑手势关闭
                                            builder: (BuildContext context)
                                            {
                                              return chooseCitySheet(chooseType: 4,cityData: cityData,chooseCityList: endAddressTwo, chooseCodeList: endCitycodeTwo,);
                                            });
                                        if (result != null) {
                                          setState(() {
                                            endCitynameTwo = result[0]+" "+result[1]+" "+result[2];
                                            endCitycodeTwo =[result[3],result[4],result[5]];
                                            endAddressTwo=[result[0],result[1],result[2]];
                                          });
                                        }
                                      },
                                    ),

                                  ),

                                  Divider(height: 10.h,color: MyColors.backgreyColor,),
                                  Container(
                                    width:screenSize.width-120.w,
                                    padding: EdgeInsets.only(left: 10.w),
                                    child:   GestureDetector(
                                      child:Text(detailAddressFour!=""?detailAddressFour:"必填，请填写详细地址",overflow: TextOverflow.clip,style: TextStyle(color: detailAddressFour!=""?Colors.black:MyColors.hintColor,fontSize: 14.sp),),
                                      onTap: ()async{
                                        final result = await  Navigator.push( context, FadeRoute(page:LoadingAddressView(addressType: 2, query: endAddressTwo.isNotEmpty?endAddressTwo[1]:"",)));
                                        if(result!=null){
                                          setState(() {
                                            endCitynameTwo=result['province']+" "+result['city']+" "+result['district'];
                                            endCitycodeTwo=[result['adcode'].substring(0, 2)+"0000",result['adcode'].substring(0, 4)+"00",result['adcode']];
                                            endAddressTwo=[result['province'],result['city'],result['district']];
                                            detailAddressFour=result['address'];
                                            endLocationTwo=result['location'];
                                          });

                                        }
                                      },
                                    ),

                                  ),
                                ],
                              ),
                            ],
                          ),

                          IconButton(onPressed: (){
                            setState(() {
                              isAddEnd=false;
                            });
                          }, icon: Icon(Icons.remove_circle_outline,color: MyColors.textColor,)),
                        ],
                      ),
                  ],
                ),
              ),
              Container(
                  margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
                  padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(10))),
                  child:Column(
                    children: [
                      GestureDetector(
                        child:Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children:[
                                Text("  ",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                Text("调度方式",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                              ]
                            ),
                          
                            Row(
                              children: [
                                schedulingMethod==""?
                                Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 14.sp),):
                                Text(schedulingMethod,style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                              ],

                            ),
                          ],
                        ),
                        onTap: (){
                            showModalBottomSheet(context: context,
                              isScrollControlled:true,
                              builder: (BuildContext context)
                              {
                                return  Container(
                                  height:250.h ,
                                  padding: EdgeInsets.only(left: 10.w,right: 10.w,top: 15.h,bottom: 30.h),
                                  decoration: BoxDecoration(
                                      color: Colors.white,
                                      borderRadius: BorderRadius.all(Radius.circular(10))),
                                  child: Column(
                                    children: [
                                      Text("请选择调度方式",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600)),
                                      SizedBox(height: 15.h,),
                                      GestureDetector(
                                        child: Text("平台找车",style: TextStyle(color:schedulingMethod=="平台找车"?MyColors.themeColor: Colors.black,fontSize: 14.sp),),
                                        onTap: (){
                                          setState(() {
                                            schedulingMethod="平台找车";
                                            showType=1;
                                          });
                                          Navigator.pop(context);
                                        },
                                      ),
                                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                                      GestureDetector(
                                        child: Text("自有车",style: TextStyle(color: schedulingMethod=="自有车"?MyColors.themeColor: Colors.black,fontSize: 14.sp),),
                                        onTap: (){
                                          setState(() {
                                            schedulingMethod="自有车";
                                            showType=2;
                                          });
                                          Navigator.pop(context);
                                        },
                                      ),
                                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                                      GestureDetector(
                                        child: Text("承运商",style: TextStyle(color:schedulingMethod=="承运商"?MyColors.themeColor: Colors.black,fontSize: 14.sp),),
                                        onTap: (){
                                          setState(() {
                                            schedulingMethod="承运商";
                                            showType=3;
                                          });
                                          Navigator.pop(context);
                                        },
                                      ),
                                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                                      GestureDetector(
                                        child: Text("外调车",style: TextStyle(color: schedulingMethod=="外调车"?MyColors.themeColor: Colors.black,fontSize: 14.sp),),
                                        onTap: (){
                                          setState(() {
                                            schedulingMethod="外调车";
                                            showType=4;
                                          });
                                          Navigator.pop(context);
                                        },
                                      ),
                                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                                      SizedBox(height: 10.h,),
                                      GestureDetector(
                                        child: Text("取消",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                        onTap: (){
                                          Navigator.pop(context);
                                        },
                                      ),
                                    ],
                                  ),
                                );

                              }
                          );
                        },
                      ),
                      if(showType==1||showType==4)
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      if(showType==1||showType==4)
                      GestureDetector(
                        child:Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                Text("发票类型",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                              ],
                            ),

                            Row(
                              children: [
                                Text(invoiceType==1?"不开发票": "专票",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                              ],
                            ),

                          ],
                        ),
                        onTap:()async{
                          final result = await  showModalBottomSheet(context: context,
                              isScrollControlled:true,
                              isDismissible: false, // 设置为 false，点击外部区域不关闭
                              enableDrag: false, // 设置为 false，禁用上滑手势关闭
                              builder: (BuildContext context)
                              {
                                return  InvoiceTypeSheet(invoiceType: invoiceType,);
                              });
                          if (result != null) {
                            setState(() {
                              invoiceType = result;
                            });
                          }

                        }
                      ),
                      if(showType==1||showType==4)
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      if(showType==1||showType==4)
                      GestureDetector(
                        child:Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                Text("调度员",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                              ],
                            ),

                            Row(
                              children: [
                                schedulingIndex!=-1?
                                Text(scheduNameList[schedulingIndex],style: TextStyle(color: Colors.black,fontSize: 14.sp),):
                                Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 14.sp),),
                                Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                              ],
                            ),

                          ],
                        ),
                        onTap: (){
                          showModalBottomSheet(
                              context: context,
                              builder: (BuildContext context) {
                                return Container(
                                    width: screenSize.width,
                                    padding: EdgeInsets.only(left: 10.w, right: 10.w, top: 15.h),
                                    decoration: BoxDecoration(
                                      borderRadius: BorderRadius.all(Radius.circular(6)),
                                      color: Colors.white,
                                    ),
                                    child: Column(
                                      children: [
                                        Row(
                                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                          children: [
                                            SizedBox(width: 30,),
                                            Text("请选择调度员",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600),),
                                            GestureDetector(
                                              child: Icon(Icons.close,color: MyColors.textColor,size: 30,),
                                              onTap: (){Navigator.pop(context);},
                                            )
                                          ],
                                        ),
                                        Divider(height: 20.h,color: MyColors.backgreyColor,),
                                        Container(
                                            height: 35.h,
                                            margin: EdgeInsets.only(top: 8.h,bottom: 4.h,left: 10.w,right: 10.w),
                                            padding: EdgeInsets.only(left: 8.w),
                                            decoration: BoxDecoration(
                                                color:MyColors.backgreyColor,
                                                borderRadius: BorderRadius.all(Radius.circular(5))),
                                            child:Row(
                                                children: [
                                                  Icon(Icons.search,color: MyColors.authTipColor,),
                                                  Container(
                                                    height: 35.h,
                                                    width:screenSize.width-100.w,
                                                    decoration: BoxDecoration(
                                                        borderRadius: BorderRadius.all(Radius.circular(30))),
                                                    child:   TextField(
                                                      decoration: InputDecoration(
                                                        hintText: '请输入姓名或手机号',
                                                        hintStyle:TextStyle(fontSize: 14.sp,color: MyColors.textColor),
                                                        filled: true,
                                                        fillColor: MyColors.backgreyColor,
                                                        border: InputBorder.none,
                                                        alignLabelWithHint: true,
                                                        // contentPadding: EdgeInsets.symmetric(vertical: 10.0.h, horizontal: 10.0.w),
                                                      ),
                                                      textAlign: TextAlign.left,
                                                      style: TextStyle(color: Colors.black),
                                                      onChanged: (value) {
                                                        setState(() {


                                                        });
                                                      },
                                                    ),
                                                  ),

                                                ])
                                        ),
                                        Divider(height: 16.h,color: MyColors.backgreyColor,),
                                        Container(
                                            height: screenSize.height/2-100.h,
                                            child: ListView.builder(
                                              shrinkWrap:false,
                                              itemCount:scheduNameList.length,
                                              itemBuilder: (BuildContext context, int index) {
                                                return GestureDetector(
                                                  child:
                                                  Container(
                                                    child: Column(
                                                      children: [
                                                        Row(
                                                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                                          children: [
                                                            Text("王二二(18888888888)",style: TextStyle(color:schedulingIndex==index?MyColors.themeColor: Colors.black,fontSize: 14.sp),),
                                                            Text("剩余三次",style: TextStyle(color: schedulingIndex==index?MyColors.themeColor:Colors.black,fontSize: 14.sp),),
                                                          ],
                                                        ),

                                                        Divider(height: 16.h,color: MyColors.backgreyColor,),
                                                      ],
                                                    ),
                                                  ),
                                                  onTap: (){
                                                    setState(() {
                                                      schedulingIndex=index;
                                                    });
                                                    Navigator.pop(context);

                                                  },
                                                );
                                              },
                                            )
                                        ),
                                      ],
                                    )
                                );
                              }
                          );
                        },
                      ),
                      if(showType==4||showType==1)
                      Divider(height: 16.h,color: MyColors.backgreyColor,),
                      if(showType==4)
                      GestureDetector(
                        child:Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                Text("承运司机",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                              ],
                            ),
                            Row(
                              children: [
                                Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 14.sp),),
                                Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                              ],
                            ),
                          ],
                        ),
                        onTap:(){
                          Navigator.push( context, FadeRoute(page: TMSChooseDriver()));

                        }
                      ),
                      if(showType==1)
                        GestureDetector(
                            child:Row(
                              mainAxisAlignment: MainAxisAlignment.spaceBetween,
                              children: [
                                Row(
                                  children: [
                                    Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                    Text("车长车型",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  ],
                                ),
                                Row(
                                  children: [
                                    !carLength.isEmpty&&!carType.isEmpty?
                                    Text(carLength.map((element) => '$element米').join(', ').replaceAll(" ", "")+"\n"+carType.join(', ').replaceAll(" ", ""),style: TextStyle(color: Colors.black,fontSize: 14.sp),):
                                    Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 14.sp),),
                                    Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                                  ],
                                ),
                              ],
                            ),
                          onTap: ()async{
                            final result = await  showModalBottomSheet(context: context,
                                isScrollControlled:true,
                                isDismissible: false, // 设置为 false，点击外部区域不关闭
                                enableDrag: false, // 设置为 false，禁用上滑手势关闭
                                builder: (BuildContext context)
                                {
                                  return  carLengthandTypeSheet(carLength: carLength, carType: carType,);
                                });
                            if (result != null) {
                              setState(() {
                                carLength = result[0];
                                carType=result[1];
                              });
                            }
                          },
                        ),
                    ],
                  ),

              ),
              Container(
                margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
                padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(10))),
                child: Column(
                  children: [
                    GestureDetector(
                      child:Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                              Text("装货时间",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                            ],
                          ),

                          Row(
                            children: [
                              startTimeDay!=""&&startTimeHour!=""?
                              Text(startTimeDay+" "+startTimeHour,style: TextStyle(color: Colors.black,fontSize: 13.sp),):
                              Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 13.sp),),
                              Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                            ],
                          ),
                        ],
                      ),
                      onTap: ()async{
                        final result = await  showModalBottomSheet(context: context,
                            isScrollControlled:true,
                            isDismissible: false, // 设置为 false，点击外部区域不关闭
                            enableDrag: false, // 设置为 false，禁用上滑手势关闭
                            builder: (BuildContext context)
                            {
                              return  ChooseTimeSheet(chooseTimeType: 1, timeDay: startTimeDay, timeHour: startTimeHour, timeCode: startTimeCode,);
                            });
                        if (result != null) {
                          setState(() {
                            startTimeDay = result[0];
                            startTimeHour = result[1];
                            startTimeCode =result[2];
                          });
                        }
                      },
                    ),
                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                    GestureDetector(
                      child:Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Row(
                                  children:[
                                    Text("  ",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                    Text("卸货时间",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                  ]
                              ),
                              
                            ],
                          ),

                          Row(
                            children: [
                              endTimeDay!=""&&endTimeHour!=""?
                              Text(endTimeDay+" "+endTimeHour,style: TextStyle(color: Colors.black,fontSize: 13.sp),):
                              Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 13.sp),),
                              Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                            ],
                          ),

                        ],
                      ),
                        onTap: ()async {
                          final result = await showModalBottomSheet(context: context,
                              isScrollControlled: true,
                              isDismissible: false,
                              // 设置为 false，点击外部区域不关闭
                              enableDrag: false,
                              // 设置为 false，禁用上滑手势关闭
                              builder: (BuildContext context) {
                                return ChooseTimeSheet(chooseTimeType: 2,
                                  timeDay: endTimeDay,
                                  timeHour: endTimeHour,
                                  timeCode: endTimeCode,);
                              });
                          if (result != null) {
                            setState(() {
                              endTimeDay = result[0];
                              endTimeHour = result[1];
                              endTimeCode = result[2];
                            });
                          }
                        }
                    ),
                    if(showType==1||showType==4)
                    Column(
                      children: [
                        Divider(height: 16.h,color: MyColors.backgreyColor,),
                        Row(
                          children: [
                            Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                            Text("总重量/体积",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                            Text("(至少填写一项)",style: TextStyle(color: Colors.black,fontSize: 12.sp),),
                          ],
                        ),
                        SizedBox(height: 10.h,),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text("重量（吨）",style: TextStyle(color: Colors.black,fontSize: 14.sp)),
                            Container(
                              width: 200.w,
                              height: 35.h,
                              child:  Center(
                                child:  TextField(
                                  decoration: InputDecoration(
                                    hintText:  goodsWeight!=""?goodsWeight:'请输入货物重量',
                                    hintStyle:goodsWeight!=""?TextStyle(fontSize: 14.sp,color: Colors.black):TextStyle(fontSize: 14.sp,color: MyColors.hintColor),
                                    filled: true,
                                    fillColor: MyColors.backgreyColor,
                                    border: InputBorder.none,
                                    alignLabelWithHint: true,
                                    // contentPadding: EdgeInsets.symmetric(vertical: 8.0.h, horizontal:8.0.h),
                                  ),
                                  keyboardType: TextInputType.number,
                                  textAlign: TextAlign.left,
                                  style: TextStyle(color: Colors.black),
                                  onChanged: (value) {
                                    setState(() {
                                      print(value);
                                      goodsWeight=value;
                                    });
                                  },
                                ),
                              ),


                            ),
                          ],
                        ),
                        SizedBox(height: 8.h,),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Text("体积（方）",style: TextStyle(color: Colors.black,fontSize: 14.sp)),
                            Container(
                              width: 200.w,
                              height: 35.h,
                              child:  Center(
                                child:  TextField(
                                  decoration: InputDecoration(
                                    hintText:  goodsVolume!=""?goodsVolume:'请输入货物体积',
                                    hintStyle:goodsVolume!=""?TextStyle(fontSize: 14.sp,color: Colors.black):TextStyle(fontSize: 14.sp,color: MyColors.hintColor),
                                    filled: true,
                                    fillColor: MyColors.backgreyColor,
                                    border: InputBorder.none,
                                    alignLabelWithHint: true,
                                    // contentPadding: EdgeInsets.symmetric(vertical: 8.0.h, horizontal:8.0.h),
                                  ),
                                  keyboardType: TextInputType.number,
                                  textAlign: TextAlign.left,
                                  style: TextStyle(color: Colors.black),
                                  onChanged: (value) {
                                    setState(() {
                                      print(value);
                                      goodsVolume=value;
                                    });
                                  },
                                ),
                              ),


                            ),
                          ],
                        ),
                      ],
                    )
               
                  ],
                ),
              ),
              if(showType==2)
              Container(
                margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
                padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(10))),
                child: Column(
                  children: [
                    GestureDetector(
                      child:Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Text("  ",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                              Text("承运车辆",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                            ],
                          ),

                          Row(
                            children: [
                              Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 13.sp),),
                              Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                            ],
                          ),
                        ],
                      ),
                      onTap: ()async{
                        final result = await  showModalBottomSheet(context: context,
                            isScrollControlled:true,
                            builder: (BuildContext context)
                            {
                              return  Container(
                                height: 350.h,
                                decoration: BoxDecoration(
                                    color: Colors.white,
                                    borderRadius: BorderRadius.all(Radius.circular(10))),
                                child: Column(children: [
                                  Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      TextButton(onPressed: (){Navigator.pop(context);}, child: Text("取消",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),)),
                                      Text("请选择承运车辆",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600),),
                                      TextButton(onPressed: (){}, child: Text("确定",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),)),
                                    ],
                                  ),
                                  Container(
                                    height: 35.h,
                                    width: screenSize.width-30.w,
                                    decoration: BoxDecoration(
                                        borderRadius: BorderRadius.all(Radius.circular(30))),
                                    child:   TextField(
                                      decoration: InputDecoration(
                                        hintText: '请输入车牌号码',
                                        hintStyle:TextStyle(fontSize: 14.sp,color: MyColors.textColor),
                                        filled: true,
                                        fillColor: MyColors.backgreyColor,
                                        border: InputBorder.none,
                                        alignLabelWithHint: true,
                                        // contentPadding: EdgeInsets.symmetric(vertical: 10.0.h, horizontal: 10.0.w),
                                      ),
                                      textAlign: TextAlign.left,
                                      style: TextStyle(color: Colors.black),
                                      onChanged: (value) {
                                        setState(() {


                                        });
                                      },
                                    ),
                                  ),
                                  SizedBox(height: 15.h,),
                                  Container(
                                    height: 180.h,
                                    child: ListView.builder(
                                        shrinkWrap:false,
                                        itemCount:3,
                                        itemBuilder: (BuildContext context, int index) {
                                          return GestureDetector(
                                            child: Column(
                                              children: [
                                                Text("苏E12345丨17.5米丨飞翼车",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                                Divider(height: 16.h,color: MyColors.backgreyColor,),
                                              ],
                                            ),
                                            onTap: (){

                                            },
                                          );
                                           }
                                           ),
                                  ),
                                  BrnSmallOutlineButton(
                                    title: '新增车辆',
                                    lineColor: MyColors.themeColor,
                                    textColor: MyColors.themeColor,
                                    width: screenSize.width-30.w,
                                    fontSize: 14.sp,
                                    radius: 30,
                                    onTap: () {
                                      Navigator.pop(context);
                                      Navigator.push( context, FadeRoute(page:AddCarrierVehicles()));


                                    },
                                  )
                                ],
                                ),
                              );
                            });
                        if (result != null) {
                          setState(() {

                          });
                        }

                      },
                    ),
                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                    GestureDetector(
                      child:Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Text("  ",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                              Text("承运司机",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                            ],
                          ),

                          Row(
                            children: [
                              Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 13.sp),),
                              Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                            ],
                          ),
                        ],
                      ),
                      onTap: ()async{
                        final result = await  showModalBottomSheet(context: context,
                            isScrollControlled:true,
                            builder: (BuildContext context)
                            {
                              return  Container(
                                height: 350.h,
                                decoration: BoxDecoration(
                                    color: Colors.white,
                                    borderRadius: BorderRadius.all(Radius.circular(10))),
                                child: Column(children: [
                                  Row(
                                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                    children: [
                                      TextButton(onPressed: (){Navigator.pop(context);}, child: Text("取消",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),)),
                                      Text("请选择承运司机",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600),),
                                      TextButton(onPressed: (){}, child: Text("确定",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),)),
                                    ],
                                  ),
                                  SizedBox(height: 15.h,),
                                  Container(
                                    height: 35.h,
                                    width:screenSize.width-30.w,
                                    decoration: BoxDecoration(
                                      color: MyColors.backgreyColor,
                                        borderRadius: BorderRadius.all(Radius.circular(30))),
                                    child:   TextField(
                                      decoration: InputDecoration(
                                        hintText: '请输入姓名或手机号',
                                        hintStyle:TextStyle(fontSize: 14.sp,color: MyColors.textColor),
                                        filled: true,
                                        fillColor: MyColors.backgreyColor,
                                        border: InputBorder.none,
                                        alignLabelWithHint: true,
                                        // contentPadding: EdgeInsets.symmetric(vertical: 10.0.h, horizontal: 10.0.w),
                                      ),
                                      textAlign: TextAlign.left,
                                      style: TextStyle(color: Colors.black),
                                      onChanged: (value) {
                                        setState(() {


                                        });
                                      },
                                    ),
                                  ),
                                  Container(
                                    height: 180.h,
                                    child: ListView.builder(
                                        shrinkWrap:false,
                                        itemCount:3,
                                        itemBuilder: (BuildContext context, int index) {
                                          return GestureDetector(
                                            child: Column(
                                              children: [
                                                Text("王二二（19999999999）",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                                Divider(height: 16.h,color: MyColors.backgreyColor,),
                                              ],
                                            ),
                                            onTap: (){

                                            },
                                          );
                                        }
                                    ),
                                  ),
                                  BrnSmallOutlineButton(
                                    title: '新增车辆',
                                    lineColor: MyColors.themeColor,
                                    textColor: MyColors.themeColor,
                                    width: screenSize.width-30.w,
                                    fontSize: 14.sp,
                                    radius: 30,
                                    onTap: () {
                                      Navigator.pop(context);
                                      Navigator.push( context, FadeRoute(page:AddCarrierDrivers()));


                                    },
                                  )
                                ],
                                ),
                              );
                            });
                        if (result != null) {
                          setState(() {

                          });
                        }

                      },
                    ),
                  ],
                ),
              ),
              if(showType==1||showType==4)
              Container(
                margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
                padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
                decoration: BoxDecoration(
                    color: Colors.white,
                    borderRadius: BorderRadius.all(Radius.circular(10))),
                child:Column(
                  children: [
                    GestureDetector(
                      child:Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                              Text("应付运费",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                            ],
                          ),
                          Container( 
                            width: 80.w,
                            height: 40.h,
                            child:  TextField(
                              focusNode: _focusNode,
                              controller: _priceNumText,
                              decoration: InputDecoration(
                                hintText: '请输入',
                                // labelText:widget.editType==1?"":depositNum ,
                                hintStyle:TextStyle(fontSize: 12.sp,color: MyColors.hintColor),
                                filled: true,
                                fillColor: Colors.white,
                                border: InputBorder.none,
                                alignLabelWithHint: true,
                                // contentPadding: EdgeInsets.symmetric(vertical: 8.5.h, horizontal: 0.0.w),
                              ),
                              keyboardType: TextInputType.number,
                              textAlign: TextAlign.left,
                              style: TextStyle(color: Colors.black,fontSize: 14.sp),
                              onChanged: (value) {
                                setState(() {
                                  priceNum=value;
                                  print(value);
                                });
                              },
                            ),
                          ),
                          Row(
                            children: [
                              BrnSmallMainButton(
                                title: '趟',
                                width: 40.w,
                                fontSize: 14.sp,
                                fontWeight: FontWeight.w100,
                                textColor:BidType==1?MyColors.themeColor: Colors.black,
                                bgColor:BidType==1?Color.fromRGBO(251, 236, 228, 1) :MyColors.backgreyColor,
                                onTap: () {
                                  setState(() {
                                    BidType =1;

                                  });

                                },
                              ),
                              SizedBox(width: 8.w,),
                              BrnSmallMainButton(
                                title: '吨',
                                width: 40.w,
                                fontSize: 14.sp,
                                fontWeight: FontWeight.w100,
                                textColor:BidType==2?MyColors.themeColor: Colors.black,
                                bgColor:BidType==2?Color.fromRGBO(251, 236, 228, 1) :MyColors.backgreyColor,
                                onTap: () {
                                  setState(() {
                                    BidType =2;
                                  });
                                },
                              ),
                              SizedBox(width: 8.w,),
                              BrnSmallMainButton(
                                title: '方',
                                width: 40.w,
                                fontSize: 14.sp,
                                fontWeight: FontWeight.w100,
                                textColor:BidType==3?MyColors.themeColor: Colors.black,
                                bgColor:BidType==3?Color.fromRGBO(251, 236, 228, 1) :MyColors.backgreyColor,
                                onTap: () {
                                  setState(() {
                                    BidType =3;
                                  });
                                },
                              ),
                            ],
                          ),
                        ],

                      ),
                    ),
                    if(showType==1|| showType==4)
                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                    if(showType==4)
                    GestureDetector(
                      child:Row(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: [
                          Row(
                            children: [
                              Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                              Text("付费方式",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                            ],
                          ),

                          Row(
                            children: [
                              Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 14.sp),),
                              Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                            ],
                          ),

                        ],
                      ),
                      onTap:(){
                        showModalBottomSheet(context: context,
                            isScrollControlled:true,
                            builder: (BuildContext context)
                            {
                              return  Container(
                                height:350.h ,
                                padding: EdgeInsets.only(left: 10.w,right: 10.w,top: 15.h,bottom: 30.h),
                                decoration: BoxDecoration(
                                    color: Colors.white,
                                    borderRadius: BorderRadius.all(Radius.circular(10))),
                                child: Column(
                                  children: [
                                    Row(
                                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                      children: [
                                        TextButton(onPressed: (){Navigator.pop(context);}, child:Text("取消",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),),),
                                        Text("请输入付费方式",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600)),
                                        TextButton(onPressed: (){Navigator.pop(context);}, child:Text("确定",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),),
                                      ],
                                    ),
                                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                                    Row(
                                      children: [
                                        Text("现付（元）",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                        Container(
                                          width: 120.w,
                                          height: 40.h,
                                          child:  TextField(
                                            decoration: InputDecoration(
                                              hintText: '请输入',
                                              // labelText:widget.editType==1?"":depositNum ,
                                              hintStyle:TextStyle(fontSize: 13.sp,color: MyColors.hintColor),
                                              filled: true,
                                              fillColor: Colors.white,
                                              border: InputBorder.none,
                                              alignLabelWithHint: true,
                                              // contentPadding: EdgeInsets.symmetric(vertical: 8.5.h, horizontal: 0.0.w),
                                            ),
                                            keyboardType: TextInputType.number,
                                            textAlign: TextAlign.left,
                                            style: TextStyle(color: Colors.black,fontSize: 14.sp),
                                            onChanged: (value) {
                                              setState(() {

                                                print(value);
                                              });
                                            },
                                          ),
                                        ),
                                      ],
                                    ),
                                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                                    Row(
                                      children: [
                                        Text("油卡（元）",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                        Container(
                                          width: 120.w,
                                          height: 40.h,
                                          child:  TextField(
                                            decoration: InputDecoration(
                                              hintText: '请输入',
                                              // labelText:widget.editType==1?"":depositNum ,
                                              hintStyle:TextStyle(fontSize: 13.sp,color: MyColors.hintColor),
                                              filled: true,
                                              fillColor: Colors.white,
                                              border: InputBorder.none,
                                              alignLabelWithHint: true,
                                              // contentPadding: EdgeInsets.symmetric(vertical: 8.5.h, horizontal: 0.0.w),
                                            ),
                                            keyboardType: TextInputType.number,
                                            textAlign: TextAlign.left,
                                            style: TextStyle(color: Colors.black,fontSize: 14.sp),
                                            onChanged: (value) {
                                              setState(() {

                                                print(value);
                                              });
                                            },
                                          ),
                                        ),
                                      ],
                                    ),
                                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                                    Row(
                                      children: [
                                        Text("到付（元）",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                        Container(
                                          width: 120.w,
                                          height: 40.h,
                                          child:  TextField(
                                            decoration: InputDecoration(
                                              hintText: '请输入',
                                              // labelText:widget.editType==1?"":depositNum ,
                                              hintStyle:TextStyle(fontSize: 13.sp,color: MyColors.hintColor),
                                              filled: true,
                                              fillColor: Colors.white,
                                              border: InputBorder.none,
                                              alignLabelWithHint: true,
                                              // contentPadding: EdgeInsets.symmetric(vertical: 8.5.h, horizontal: 0.0.w),
                                            ),
                                            keyboardType: TextInputType.number,
                                            textAlign: TextAlign.left,
                                            style: TextStyle(color: Colors.black,fontSize: 14.sp),
                                            onChanged: (value) {
                                              setState(() {

                                                print(value);
                                              });
                                            },
                                          ),
                                        ),
                                      ],
                                    ),
                                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                                    Row(
                                      children: [
                                        Text("回付（元）",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                        Container(
                                          width: 120.w,
                                          height: 40.h,
                                          child:  TextField(
                                            decoration: InputDecoration(
                                              hintText: '请输入',
                                              // labelText:widget.editType==1?"":depositNum ,
                                              hintStyle:TextStyle(fontSize: 13.sp,color: MyColors.hintColor),
                                              filled: true,
                                              fillColor: Colors.white,
                                              border: InputBorder.none,
                                              alignLabelWithHint: true,
                                              // contentPadding: EdgeInsets.symmetric(vertical: 8.5.h, horizontal: 0.0.w),
                                            ),
                                            keyboardType: TextInputType.number,
                                            textAlign: TextAlign.left,
                                            style: TextStyle(color: Colors.black,fontSize: 14.sp),
                                            onChanged: (value) {
                                              setState(() {

                                                print(value);
                                              });
                                            },
                                          ),
                                        ),
                                      ],
                                    ),
                                    Divider(height: 16.h,color: MyColors.backgreyColor,),

                                  ],
                                ),
                              );

                            }
                        );
                      }
                    ),
                    if(showType==1)
                      GestureDetector(
                          child:Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Row(
                                children: [
                                  Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                                  Text("成交方式",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                ],
                              ),

                              Row(
                              
                                children: [
                                  BrnSmallMainButton(
                                    title: '电议',
                                    width: 50.w,
                                    fontSize: 12.sp,
                                    bgColor: priceType!=0?MyColors.backgreyColor:Color(0XFFFBECE4),
                                    textColor: priceType==0?MyColors.themeColor:Colors.black,
                                    onTap: () {
                                      setState(() {
                                        priceType=0;
                                      });
                                    },
                                  ),
                                  SizedBox(width: 16.w,),
                                  BrnSmallMainButton(
                                    title: '一口价',
                                    fontSize: 12.sp,
                                    width: 50.w,
                                    bgColor: priceType!=1?MyColors.backgreyColor:Color(0XFFFBECE4),
                                    textColor: priceType==1?MyColors.themeColor:Colors.black,
                                    onTap: () {
                                      setState(() {
                                        priceType=1;
                                      });
                                    },
                                  ),
                                ],
                              ),

                            ],
                          ),

                      ),
                    Divider(height: 16.h,color: MyColors.backgreyColor,),
                    Row(
                      // crossAxisAlignment: CrossAxisAlignment.center,
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Text("订金",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                        // SizedBox(width: 8.w,),
                        Container(
                          width: 120.w,
                          height: 40.h,
                          child:  TextField(
                            focusNode: _focusNode,
                            controller: _depositNumText,
                            decoration: InputDecoration(
                              hintText: '选填，20-1000元',
                              // labelText:widget.editType==1?"":depositNum ,
                              hintStyle:TextStyle(fontSize: 12.sp,color: MyColors.hintColor),
                              filled: true,
                              fillColor: Colors.white,
                              border: InputBorder.none,
                              alignLabelWithHint: true,
                              // contentPadding: EdgeInsets.symmetric(vertical: 8.5.h, horizontal: 0.0.w),
                            ),
                            keyboardType: TextInputType.number,
                            textAlign: TextAlign.left,
                            style: TextStyle(color: Colors.black,fontSize: 14.sp),
                            onChanged: (value) {
                              setState(() {
                                depositNum=value;
                                print(value);
                              });
                            },
                          ),
                        ),

                        Text("元",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                        BrnSmallMainButton(
                          title: '退还',
                          width: 50.w,
                          fontSize: 12.sp,
                          bgColor: depositType!=0?MyColors.backgreyColor:Color(0XFFFBECE4),
                          textColor: depositType==0?MyColors.themeColor:Colors.black,
                          onTap: () {
                            setState(() {
                              depositType=0;
                            });
                          },
                        ),
                        BrnSmallMainButton(
                          title: '不退还',
                          fontSize: 12.sp,
                          width: 50.w,
                          bgColor: depositType!=1?MyColors.backgreyColor:Color(0XFFFBECE4),
                          textColor: depositType==1?MyColors.themeColor:Colors.black,
                          onTap: () {
                            setState(() {
                              depositType=1;
                            });
                          },
                        ),
                      ],
                    ),
                  ],
                )
              ),
              if(showType==1||showType==4)
              Container(
              margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
              padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
              decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.all(Radius.circular(10))),
                child:Column(
                  children: [
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Row(
                          children: [
                            Image.asset("lib/Images/OrderList/完善货源保险icon.png",width: 20.w,height: 20.h,),
                            Text("保险",style: TextStyle(color: MyColors.themeColor,fontWeight: FontWeight.w600,fontSize: 14.sp),),
                            SizedBox(width: 4.w,),
                            BrnTagCustom.buildBorderTag(
                              tagText: '司机未接单，保费自动退',
                              textColor: MyColors.themeColor,
                              borderColor: MyColors.themeColor,
                              borderWidth: 1.h,
                              fontSize: 10.sp,
                            ),
                          ],
                        ),
                        IconButton(onPressed: (){
                          setState(() {
                            isChooseInsure=!isChooseInsure;
                          });
                        }, icon:isChooseInsure? Icon(Icons.check_circle,color: MyColors.themeColor,):Icon(Icons.radio_button_off,color: MyColors.textColor,)),
                      ],
                    ),
                  ],
                ),
              ),
                if(showType==3)
                  GestureDetector(
                child:  Container(
                  margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
                  padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
                  decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(10))),
                  child:Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    children: [
                      Row(
                        children: [
                          Text("*",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),),
                          Text("承运商",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                        ],
                      ),

                      Row(
                        children: [
                          Text("请选择",style: TextStyle(color: MyColors.hintColor,fontSize: 13.sp),),
                          Icon(Icons.arrow_forward_ios,size: 14,color: MyColors.authTipColor,),
                        ],
                      ),
                    ],
                  ),
                ),
                    onTap: ()async{
                      final result = await  showModalBottomSheet(context: context,
                          isScrollControlled:true,
                          builder: (BuildContext context)
                          {
                            return  Container(
                              height: 300.h,
                              decoration: BoxDecoration(
                                  color: Colors.white,
                                  borderRadius: BorderRadius.all(Radius.circular(10))),
                              child: Column(children: [
                                Row(
                                  mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                  children: [
                                    TextButton(onPressed: (){Navigator.pop(context);}, child: Text("取消",style: TextStyle(color: MyColors.textColor,fontSize: 14.sp),)),
                                    Text("请选择承运商",style: TextStyle(color: Colors.black,fontSize: 16.sp,fontWeight: FontWeight.w600),),
                                    TextButton(onPressed: (){}, child: Text("确定",style: TextStyle(color: MyColors.themeColor,fontSize: 14.sp),)),
                                  ],
                                ),
                                SizedBox(height: 15.h,),
                                Container(
                                  height: 180.h,
                                  child: ListView.builder(
                                      shrinkWrap:false,
                                      itemCount:3,
                                      itemBuilder: (BuildContext context, int index) {
                                        return GestureDetector(
                                          child: Column(
                                            children: [
                                              Text("浙江速搜物流股份有限公司",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                                              Divider(height: 16.h,color: MyColors.backgreyColor,),
                                            ],
                                          ),
                                          onTap: (){

                                          },
                                        );
                                      }
                                  ),
                                ),

                              ],
                              ),
                            );
                          });
                      if (result != null) {
                        setState(() {

                        });
                      }

                    },
                  ),
                GestureDetector(
                  child: Container(
                    margin: EdgeInsets.only(left: 10.w,top: 8.h,right: 10.w),
                    padding: EdgeInsets.only(left: 10.w,top: 10.h,right: 10.w,bottom: 10.h),
                    decoration: BoxDecoration(
                        color: Colors.white,
                        borderRadius: BorderRadius.all(Radius.circular(10))),
                    child: Column(
                      children: [
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            Row(
                              children: [
                                Text("*",style: TextStyle(color: Colors.white),),
                                Text("备注",style: TextStyle(color: Colors.black,fontSize: 14.sp),),
                              ],
                            ),
                            Row(
                              children: [
                                remarkStr==""?
                                Text("选填，填写可防治司机误抢",style: TextStyle(color: MyColors.hintColor,fontSize: 14.sp),)
                                    : Container(
                                  width: 200.w,
                                  child:Text(remarkStr,style: TextStyle(color: Colors.black,fontSize: 13.sp), overflow: TextOverflow.ellipsis,textAlign: TextAlign.right ),
                                ),
                                Icon(Icons.arrow_forward_ios,color: MyColors.hintColor,size: 14,),
                              ],
                            ) ,
                          ],
                        ),
                      ],
                    ),
                  ),
                  onTap: ()async{
                    final result = await  showModalBottomSheet(context: context,
                        isScrollControlled:true,
                        isDismissible: false, // 设置为 false，点击外部区域不关闭
                        enableDrag: false, // 设置为 false，禁用上滑手势关闭
                        builder: (BuildContext context)
                        {
                          return  RemarkMessageSheet(remarkStr: remarkStr,);
                        });
                    if (result != null) {
                      setState(() {
                        remarkStr =result;
                      });
                    }
                  },
                ),
              Container(
                margin: EdgeInsets.only(left: 10.w, right: 10.w),
                child: Row(

                  children: [
                    Column(
                      crossAxisAlignment: CrossAxisAlignment.start,
                      children: [
                        IconButton(
                          onPressed: () => {
                            setState(() {
                              if (isAgree == "1") {
                                isAgree = "0";
                              } else {
                                isAgree = "1";
                              }
                            })
                          },
                          icon:isAgree == "0" ? Icon(Icons.radio_button_unchecked,size: 20,): Icon(Icons.radio_button_checked),
                          color: isAgree == "1" ? Colors.orange : Colors.grey,
                        ),
                        SizedBox(height: 15.h,),
                      ],
                    ),
                    Container(
                      width: 290.w,
                      child:  RichText(
                        text: TextSpan(children: [
                          TextSpan(
                              text: '已阅读并同意 ',
                              style: TextStyle(fontSize: 12.sp, color: Colors.black54,)),
                          TextSpan(
                              text: '《货物运输技术服务协议》',
                              style: TextStyle(fontSize: 12.sp, color: Colors.blue),
                              recognizer: TapGestureRecognizer()
                                ..onTap = () {
                                  // 查看 服务条款
                                }),
                          TextSpan(
                              text: '《货物运输协议》',
                              style: TextStyle(fontSize: 12.sp, color: Colors.blue),
                              recognizer: TapGestureRecognizer()
                                ..onTap = () {
                                  // 查看 服务条款
                                }),

                          TextSpan(
                              text: '《开票货源发货权限管理规则》',
                              style: TextStyle(fontSize: 12.sp, color: Colors.blue),
                              recognizer: TapGestureRecognizer()
                                ..onTap = () {
                                  // 查看 服务条款
                                }),

                        ]),
                      ),
                    ),

                  ],
                ),

              ),
            ],
          ),
          ),
          Container(
            padding: EdgeInsets.only(top: 15.h,bottom: 30.h,left: 15.w,right: 15.w),
            color: Colors.white,
            height: 80.h,
            width: screenSize.width,
            child:BrnSmallMainButton(
              title: '确认调度',
              bgColor: MyColors.themeColor,
              textColor: Colors.white,
              width: screenSize.width-30.w,
              fontSize: 16.sp,
              radius: 30,
              onTap: () {

              },
            )
          )
        ],

      ),
    );
  }
}
